<template>
  <Dialog
    :show="dialogConfig.show"
    :title="dialogConfig.title"
    width="400px"
    :showCancel="false"
    @close="dialogConfig.show = false"
  >
    <el-form-item label="好友头像">
      <Image :width="50" :src="formData.contactIcon" />
    </el-form-item>
    <el-form-item label="好友名称">
      {{ formData.contactName }}
    </el-form-item>
    <el-form-item label="好友ID">
      {{ formData.contactId }}
    </el-form-item>
    <el-form-item label="好友地区">
      {{ formData.areaName }}
    </el-form-item>
    <el-form-item label="好友性别">
      <el-tag v-if="formData.sex == 1">男</el-tag>
      <el-tag type="danger" v-if="formData.sex == 0">女</el-tag>
    </el-form-item>
    <el-form-item label="好友备注">
      {{ formData.note }}
    </el-form-item>
  </Dialog>
</template>

<script setup>
import { ref, nextTick } from "vue";

const dialogConfig = ref({
  show: false,
  title: "详情",
});

const formData = ref({});
const show = (data) => {
  dialogConfig.value.show = true;
  nextTick(() => {
    formData.value = Object.assign({}, data);
  });
};

defineExpose({ show });
</script>

<style lang="scss" scoped>
.user-panel {
  display: flex;
  padding-bottom: 20px;

  .user-info {
    flex: 1;
    margin-left: 10px;

    .username {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      color: #000000;
      font-size: 16px;

      .iconfont {
        font-size: 13px;
      }

      .icon-man {
        color: #2cb6fe;
      }

      .icon-woman {
        color: #fb7373;
      }
    }

    .info {
      font-size: 12px;
      color: #9e9e9e;
      margin-top: 3px;
    }
  }
}

.part-item {
  display: flex;

  .part-title {
    width: 60px;
    color: #9e9e9e;
  }

  .part-content {
    flex: 1;
    margin-left: 15px;
    color: #161616;
  }
}
</style>
